﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Level_Light_SwitchLock : MonoBehaviour
{
    public Vector2 pos1;
    public float dis;

    public GameObject dragObj;
    public GameObject doorObj;
    void Start()
    {
        pos1 = dragObj.transform.position;
        JudePos();
    }

    private void JudePos()
    {
        if (dragObj.activeSelf)
        {
            dis = Vector2.Distance(pos1, dragObj.transform.position);
            if (dis > 350)
            {
                dragObj.SetActive(false);
                doorObj.SetActive(false);
                SoundManager.Instance.PlayAudio(SoundType.CountDown.ToString(), false);
            }
            Invoke("JudePos", 0.2f);
        }
    }

    // Update is called once per frame
    void Update()
    {

    }
}
